package com.henary.annotation;

import cn.hutool.json.JSONUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.henary.annotation.bean.*;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author henary
 * @date 2022年09月19日 13:52
 */

public class AnnotationTest {
	private static final Log log = LogFactory.get();

	public static void main(String[] args) {
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
		applicationContext.getEnvironment().setActiveProfiles("dev");
		applicationContext.register(AnnotationConfig.class);
		applicationContext.refresh();
		log.info(JSONUtil.toJsonStr(applicationContext.getBean(Person.class)));
		log.info("------------------------------------------------------------");
		log.info(JSONUtil.toJsonStr(applicationContext.getBean(Car.class)));
		log.info("------------------------------------------------------------");
		log.info(JSONUtil.toJsonStr(applicationContext.getBean(Book.class)));
		log.info("------------------------------------------------------------");
		log.info(JSONUtil.toJsonStr(applicationContext.getBean(Shoes.class)));
		log.info("------------------------------------------------------------");
		log.info(JSONUtil.toJsonStr(applicationContext.getBean(Fruit.class)));

	}

}
